#include "ReferenceCountingInterface.h"
template <typename T>
class RefCountingTraits
{
public:
	static void Refer(T* p)
	{
		p->IncRef();
	}
	static void Unrefer(T* p)
	{
		p->DecRef();
	}
};

//*Specialize
template <>
class RefCountingTraits<Widget>
{
public:
	static void Refer(Widget* p)
	{
		p->AddReference();
	}
	static void Unrefer(Widget* p)
	{
		if(p->RemoveReference() == 0)
			delete p;
	}
};